home *** CD-ROM | disk | FTP | other *** search
- OPTION BASE 0
- DIM repere#(255,255)
- PRINT "Initialisation"
- IF EXIST("donnees.dat")
- BLOAD "donnees.dat",VARPTR(repere#(0,0))
- ELSE
- FOR i%=0 TO 255
- FOR j%=0 TO 255
- repere#(i%,j%)=(j%+i%) MOD 255
- NEXT j%
- NEXT i%
- PRINT "ok!"
- adr%=VARPTR(repere#(0,0))
- BSAVE "donnees.dat",adr%,VARPTR(repere#(255,255))-adr%
- ENDIF
- '
- PRINT
- INPUT "Entrer le message
crypter :",txt$
- INPUT "Entrer votre cl de cryptage:",cle$
- PRINT
- '
- PRINT "Cryptage..."
- txt%=LEN(txt$)
- cle%=LEN(cle$)
- FOR i%=1 TO INT(txt%/cle%)+1
- code$=code$+cle$
- NEXT i%
- code$=LEFT$(code$,txt%)
- '
- '
- result$=""
- FOR i%=1 TO txt%
- a#=ASC(MID$(txt$,i%))
- b#=ASC(MID$(code$,i%))
- result$=result$+CHR$(repere#(a#,b#))
- NEXT i%
- '
- PRINT "pPhrase crypte :";result$+"q"
- '
- '
- PRINT
- PRINT "Dcryptage..."
- txt2$=""
- FOR i%=1 TO LEN(result$)
- a#=ASC(MID$(result$,i%))
- b#=ASC(MID$(code$,i%))
- txt2$=txt2$+CHR$(a#-b#)
- NEXT i%
- PRINT "pPhrase dcrypte :";txt2$+"q"
- PRINT
- '
- PRINT "Pressez une touche pour sortir."
- ~INP(2)
-